package Flyweight_Pattern.word;


import java.util.Hashtable;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class File_Factory {
    private static File_Factory instance=new File_Factory();
    private static Hashtable ht;

    private File_Factory(){
        ht=new Hashtable();
        File gif1,jpg1,mp41;
        gif1=new Gif();
        ht.put("g",gif1);
        jpg1=new Jpg();
        ht.put("j",jpg1);
        mp41=new Mp4();
        ht.put("m",mp41);
    }
    public static File_Factory getInstance(){
        return instance;
    }

    public static File getFile(String string){
        return (File) ht.get(string);
    }
}
